package com.ruoyi.system.service.impl;

import java.util.Date;
import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.SysAttendanceRecordMapper;
import com.ruoyi.system.domain.SysAttendanceRecord;
import com.ruoyi.system.service.ISysAttendanceRecordService;

/**
 * 考勤管理Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-04-21
 */
@Service
public class SysAttendanceRecordServiceImpl extends ServiceImpl< SysAttendanceRecordMapper, SysAttendanceRecord> implements ISysAttendanceRecordService
{
    @Autowired
    private SysAttendanceRecordMapper sysAttendanceRecordMapper;

    /**
     * 查询考勤管理
     * 
     * @param id 考勤管理主键
     * @return 考勤管理
     */
    @Override
    public SysAttendanceRecord selectSysAttendanceRecordById(Long id)
    {
        return sysAttendanceRecordMapper.selectSysAttendanceRecordById(id);
    }

    /**
     * 查询考勤管理列表
     * 
     * @param sysAttendanceRecord 考勤管理
     * @return 考勤管理
     */
    @Override
    public List<SysAttendanceRecord> selectSysAttendanceRecordList(SysAttendanceRecord sysAttendanceRecord)
    {
        return sysAttendanceRecordMapper.selectSysAttendanceRecordList(sysAttendanceRecord);
    }

    /**
     * 新增考勤管理
     * 
     * @param sysAttendanceRecord 考勤管理
     * @return 结果
     */
    @Override
    public int insertSysAttendanceRecord(SysAttendanceRecord sysAttendanceRecord) {
        sysAttendanceRecord.setCreateTime(DateUtils.getNowDate());
        sysAttendanceRecord.setCheckInTime(DateUtils.getNowDate());
        sysAttendanceRecord.setUserId(SecurityUtils.getUserId());
        return sysAttendanceRecordMapper.insertSysAttendanceRecord(sysAttendanceRecord);
    }

    /**
     * 修改考勤管理
     * 
     * @param sysAttendanceRecord 考勤管理
     * @return 结果
     */
    @Override
    public int updateSysAttendanceRecord(SysAttendanceRecord sysAttendanceRecord)
    {
        sysAttendanceRecord.setUpdateTime(DateUtils.getNowDate());
        return sysAttendanceRecordMapper.updateById(sysAttendanceRecord);
    }

    /**
     * 批量删除考勤管理
     * 
     * @param ids 需要删除的考勤管理主键
     * @return 结果
     */
    @Override
    public int deleteSysAttendanceRecordByIds(Long[] ids)
    {
        return sysAttendanceRecordMapper.deleteSysAttendanceRecordByIds(ids);
    }

    /**
     * 删除考勤管理信息
     * 
     * @param id 考勤管理主键
     * @return 结果
     */
    @Override
    public int deleteSysAttendanceRecordById(Long id)
    {
        return sysAttendanceRecordMapper.deleteSysAttendanceRecordById(id);
    }
}
